﻿@inject BaseWebElement _baseWebElement;
@model ContentClass
@{
    var Path = ViewData["path"] as string;
    Layout = "~/Views/Shared/_Layout.cshtml";
    var CompanyName = _baseWebElement.GetWebElement(WebElementType.CompanyName)?.Value;
    var LocationClass = _baseWebElement.GetCurrentRoute(Model.Id);
    ViewData["Title"] = Model.ClassName + " - " + CompanyName;
    var CurrentlanguageclassHref = _baseWebElement.GetCurrentlanguageclassHref();
}
<div class="wrapper">
    <div class="crumbs">
        <div class="container">
            <p class="weizhi">
                @(_baseWebElement.QueryLanText("Location"))：<a href="@(CurrentlanguageclassHref)">@(_baseWebElement.QueryLanText("Home"))</a>
                @if (LocationClass != null && LocationClass.Count > 0)
                {
                    foreach (var item in LocationClass)
                    {
                        @Html.Raw("&gt")<a href="@(item.ClassHref)">@item.ClassName</a>
                    }
                }
            </p>
        </div>
    </div>
    <div class="contactBox">
        <div class="container">
            <div class="contactBg" style="background-image: url(/images/contactBg.jpg);">
                <p>我们来谈谈如何让您的业务更上一层楼</p>
                <small>let’s talk about how we can take your business to the next level</small>
            </div>
            <div class="row">
                <div class="col-md-6 col-xs-12">
                    <div class="compTxt">
                        @Html.Raw(Model.Content)
                    </div>
                </div>
                <div class="col-md-6 col-xs-12">
                    <div class="contactForm">
                        <form>
                            <label>
                                <P>@(_baseWebElement.QueryLanText("Message_name"))</P>
                                <input name="name" type="text" />
                            </label>
                            <label>
                                <P><sup>*</sup>@(_baseWebElement.QueryLanText("Message_phone"))</P>
                                <input name="phone" type="text" />
                            </label>
                            <label>
                                <P><sup>*</sup>@(_baseWebElement.QueryLanText("Message_email"))</P>
                                <input name="email" type="text" />
                            </label>
                            <label>
                                <P>@(_baseWebElement.QueryLanText("Message_company"))</P>
                                <input name="company" type="text" />
                            </label>
                            <label>
                                <P><sup>*</sup>@(_baseWebElement.QueryLanText("Message_content"))</P>
                                <textarea name="content"></textarea>
                            </label>
                            <label>
                                <p><sup>*</sup>@(_baseWebElement.QueryLanText("Message_verification"))</p>
                                <div class="code">
                                    <input name="verifyCode" type="text">
                                    <img src="/ajax/GetVerification?v=@DateTime.Now.ToString()">
                                </div>

                            </label>
                            <button type="button" onclick="PostMessage()">@(_baseWebElement.QueryLanText("Submit"))</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section Scripts{ 
<script type="text/javascript">
    function PostMessage() {
        var data = {
            name: $("[name=name]").val(),
            phone: $("[name=phone]").val(),
            email: $("[name=email]").val(),
            company: $("[name=company]").val(),
            content: $("[name=content]").val(),
            verifyCode: $("[name=verifyCode]").val(),
            language:@(_baseWebElement.Currentlanguage.Id)
        };
        $.ajax({
            url: "/ajax/PostMessage",
            type: "post",
            data: JSON.stringify(data),
            contentType: "application/json",
            dataType: "json",
            success: function (result) {
                alert(result.message)
                if (result.success) {
                    window.location.reload();
                }
            }
        });
        return false;
    }
</script>
}
